/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * CharacteristicPickListValue generated by hbm2java
 */
@Entity
@Table(name = "ED_CHAR_PICK_LIST_VALUE")
public class CharacteristicPickListValue extends AttributableUpdateRetireEntity
		implements
			java.io.Serializable {

	private Long uid;
	private Characteristic characteristic;
	private String code;
	private String description;
	private Set<Result> results = new HashSet<Result>(0);

	public CharacteristicPickListValue() {
	}

	public CharacteristicPickListValue(Long uid, Characteristic characteristic,
			String code) {
		this.uid = uid;
		this.characteristic = characteristic;
		this.code = code;
	}

	@Id
	@Column(name = "CPLVAL_UID", unique = true, nullable = false, precision = 6, scale = 0)
	@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CHR_UID", nullable = false)
	@NotNull
	public Characteristic getCharacteristic() {
		return this.characteristic;
	}

	public void setCharacteristic(Characteristic characteristic) {
		this.characteristic = characteristic;
	}

	@Column(name = "CPLVAL_CD", nullable = false, length = 12)
	@NotNull
	@Length(max = 12)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "CPLVAL_DESC", length = 60)
	@Length(max = 60)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "characteristicPickListValue")
	public Set<Result> getResults() {
		return this.results;
	}

	public void setResults(Set<Result> results) {
		this.results = results;
	}

}
